package com.ruoyi.project.dataviewSystem.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.dataviewSystem.domain.VWarningPicture;
import com.ruoyi.project.dataviewSystem.service.IVWarningPictureService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 告警处理Controller
 * 
 * @author wangshuo
 * @date 2021-02-13
 */
@RestController
@RequestMapping("/dataviewSystem/vwarningPicture")
public class VWarningPictureController extends BaseController
{
    @Autowired
    private IVWarningPictureService vWarningPictureService;

    /**
     * 查询告警处理列表
     */
    @PreAuthorize("@ss.hasPermi('dataviewSystem:vwarningPicture:list')")
    @GetMapping("/list")
    public TableDataInfo list(VWarningPicture vWarningPicture)
    {
        startPage();
        List<VWarningPicture> list = vWarningPictureService.selectVWarningPictureList(vWarningPicture);
        return getDataTable(list);
    }

    /**
     * 导出告警处理列表
     */
    @PreAuthorize("@ss.hasPermi('dataviewSystem:vwarningPicture:export')")
    @Log(title = "告警处理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(VWarningPicture vWarningPicture)
    {
        List<VWarningPicture> list = vWarningPictureService.selectVWarningPictureList(vWarningPicture);
        ExcelUtil<VWarningPicture> util = new ExcelUtil<VWarningPicture>(VWarningPicture.class);
        return util.exportExcel(list, "vwarningPicture");
    }

    /**
     * 获取告警处理详细信息
     */
    @PreAuthorize("@ss.hasPermi('dataviewSystem:vwarningPicture:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(vWarningPictureService.selectVWarningPictureById(id));
    }

    /**
     * 新增告警处理
     */
    @PreAuthorize("@ss.hasPermi('dataviewSystem:vwarningPicture:add')")
    @Log(title = "告警处理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody VWarningPicture vWarningPicture)
    {
        return toAjax(vWarningPictureService.insertVWarningPicture(vWarningPicture));
    }

    /**
     * 修改告警处理
     */
    @PreAuthorize("@ss.hasPermi('dataviewSystem:vwarningPicture:edit')")
    @Log(title = "告警处理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody VWarningPicture vWarningPicture)
    {
        return toAjax(vWarningPictureService.updateVWarningPicture(vWarningPicture));
    }

    /**
     * 删除告警处理
     */
    @PreAuthorize("@ss.hasPermi('dataviewSystem:vwarningPicture:remove')")
    @Log(title = "告警处理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(vWarningPictureService.deleteVWarningPictureByIds(ids));
    }
}
